/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.atomojo.sparql;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author alex
 */
public class WhereClause {

   List<Triple> clauses;
   List<Expression> filterExpressions;
   
   public WhereClause() {
      this.clauses = new ArrayList<Triple>();
      this.filterExpressions = new ArrayList<Expression>();
   }
   
   public List<Triple> getClauses() {
      return clauses;
   }
   
   public String toString() {
      StringBuilder builder = new StringBuilder();
      builder.append("WHERE {\n");
      for (Triple triple : clauses) {
         builder.append(triple.toString());
         builder.append(" .\n");
      }
      for (Expression exp : filterExpressions) {
         builder.append("FILTER");
         builder.append(exp.toString());
         builder.append("\n");
      }
      builder.append("}");
      return builder.toString();
   }
   public List<Expression> getFilterExpressions() {
      return filterExpressions;
   }
}
